<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<head>
<title>Encode and decode utility </title>
<meta name="generator" content="editplus">
<meta name="author" content="huangwei1983@gmail.com">
<meta name="keywords" content="">
<meta name="description" content="">
<SCRIPT LANGUAGE="JavaScript" src="js/encode.js"></SCRIPT>
<SCRIPT LANGUAGE="JavaScript" src="js/ascii_conv.js"></SCRIPT>
<script language="javascript">
<!--
function displayEncodeInfo(content,refid)
{
	var div_info = document.getElementById(refid);
	div_info.value=content;
	div_info.focus();
}
function displayUnicodeInfo(content,refid)
{
	var div_info = document.getElementById(refid);
	div_info.innerHTML=content;
	div_info.focus();
}
function textToUES(content){
	var vEncoded = "";
	if(content != ''){
		vEncoded = convertText2HUnicode(content);
	}
	return vEncoded;
} 
//-->
</script>
<link href="css/style.css" rel="stylesheet" type="text/css" />
</head>

<body>
<form name="codeform" >
<table>
	<tr>
		<td>
			<textarea id="content" name="content" rows="5" cols="100"></textarea>
		</td>
	</tr>
	<tr>
		<td align="center">
			<input type="button" name="button" class="button" value="hex_encode" onclick="displayEncodeInfo(encodeHex(document.codeform.content.value),'encode_info')">
			<input type="button" name="button" class="button" value="base64_encode" onclick="displayEncodeInfo(encodeBase64(document.codeform.content.value),'encode64_info')">
			<input type="button" name="button" class="button" value="url_encode_UTF8" onclick="displayEncodeInfo(urlEncodeUTF8(document.codeform.content.value),'url_encode_utf8')">
			<input type="button" name="button" class="button" value="unicode_encode" onclick="displayEncodeInfo(textToUES(document.codeform.content.value),'unicode_info')">
			<input type="button" name="button" class="button" value="html_escape" onclick="displayEncodeInfo(escapeHTML(document.codeform.content.value),'escape_info')">
			<input type="button" name="button" class="button" value="url_encode_GBK" onclick="displayEncodeInfo(urlEncodeGBK(document.codeform.content.value),'url_encode_info')">
		</td>
	</tr>
	<tr>
		<td align="center">
			<input type="button" name="button" class="button" value="hex_decode" onclick="displayEncodeInfo(decodeHex(document.codeform.content.value),'decode_info')">
			<input type="button" name="button" class="button" value="base64_decode" onclick="displayEncodeInfo(decodeBase64(document.codeform.content.value),'decode64_info')">
			<input type="button" name="button" class="button" value="url_decode_UTF8" onclick="displayEncodeInfo(urlDecodeUTF8(document.codeform.content.value),'url_decode_UTF8')">
			<input type="button" name="button" class="button" value="unicode_decode" onclick="displayUnicodeInfo(convertHUnicode2Text(document.codeform.content.value),'text_info')">
			<input type="button" name="button" class="button" value="html_unescape" onclick="displayEncodeInfo(unescapHTML(document.codeform.content.value),'unescape_info')">
		</td>
	</tr>
	<tr>
		<td align="center">
			<input type="button" name="button" class="button" value="hex_html_encode" onclick="displayEncodeInfo(convertToHexHTML(document.codeform.content.value),'url_encode_html')">
			<input type="button" name="button" class="button" value="dec_html_encode" onclick="displayEncodeInfo(convertToUnicode(document.codeform.content.value),'dec_encode_html')">
		</td>
	</tr>
	<tr>
		<td align="center">
			<input type="button" name="button" class="button" value="hex_html_decode" onclick="displayEncodeInfo(convertFromHexHTML(document.codeform.content.value),'url_decode_html')">
			<input type="button" name="button" class="button" value="dec_html_decode" onclick="displayEncodeInfo(convertToASCII(document.codeform.content.value),'dec_decode_html')">
		</td>
	</tr>
</table>
</form>
<p>
<div id="div_info" style="display:none">
</div>
</p>
<p>Hex_encoded string here:<br/>
<textarea id="encode_info" rows="5" cols="100" class="textarea">
</textarea>
</p>Hex_decoded string here:<br/>
<textarea id="decode_info" rows="5" cols="100" class="textarea">
</textarea>
<p>Base64_encoded string here:<br/>
<textarea id="encode64_info" rows="5" cols="100" class="textarea">
</textarea>
<p>Base64_decoded string here:<br/>
<textarea id="decode64_info" rows="5" cols="100" class="textarea">
</textarea>
<p>HTML escaped string here:<br/>
<textarea id="escape_info" rows="5" cols="100" class="textarea">
</textarea>
<p>HTML unescaped string here:<br/>
<textarea id="unescape_info" rows="5" cols="100" class="textarea">
</textarea>
<p>URL_encoded string using GBK here:<br/>
<textarea id="url_encode_info" rows="5" cols="100" class="textarea">
</textarea>
<p>Text to hexadecimal Unicode escape sequence (\uXXXX):<br/>
<textarea id="unicode_info" rows="5" cols="100" class="textarea">
</textarea>
<p>hexadecimal Unicode escape sequence  (\uXXXX) to Text:<br/>
<textarea id="text_info" rows="5" cols="100" class="textarea">
</textarea>
<p>URLEncoded text using UTF8<br/>
<textarea id="url_encode_utf8" rows="5" cols="100" class="textarea">
</textarea>
<p>URLDecoded text using UTF8<br/>
<textarea id="url_decode_utf8" rows="5" cols="100" class="textarea">
</textarea>
<p>HexEncoded html text<br/>
<textarea id="url_encode_html" rows="5" cols="100" class="textarea">
</textarea>
<p>HexDecoded html text<br/>
<textarea id="url_decode_html" rows="5" cols="100" class="textarea">
</textarea>
<p>DecEncoded html text<br/>
<textarea id="dec_encode_html" rows="5" cols="100" class="textarea">
</textarea>
<p>DecDecoded html text<br/>
<textarea id="dec_decode_html" rows="5" cols="100" class="textarea">
</textarea>
</body>
</html>
